<?php 

class LoginController extends Controller{
	public function __init(){
		define('__TEMPLATE__',__ROOT__ .'/Template/jd');
		
	}
	public function index(){
		if (IS_POST) {
			$username=$_POST['username'];
			$password=$_POST['password'];
			$user = M('user')->where("username='{$username}'")->find();
			if ($user) {
				if ($user['password']==$password) {
					$_SESSION['username']=$username;
					go('index/index/index');

				}
			}else{
				$this->error('用户名不存在','index/login/index');
			}
		}else{
			$this->display('Template/jd/login.html');
		}
		
	}
}

 ?>